package com.huidu.bitrade.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 用户变现枚举
 */
@Getter
@AllArgsConstructor
public enum MemberLoanStatus {

    AUDITING(1,"审核中"),
    WAIT_REDEMPTION(2,"待赎回"),
    REDEMPTION_OVER(3,"已赎回"),
    REJECT(4,"拒绝");

    public static MemberLoanStatus getByStatus(Integer status){
        return Arrays.stream(MemberLoanStatus.values())
                .filter(p -> p.getStatus().equals(status))
                .findFirst().get();
    }

    @EnumValue
    private Integer status;

    @JsonValue
    private String name;

}
